package com.mbbb.easyExcel;

import com.alibaba.excel.EasyExcel;

import java.util.ArrayList;
import java.util.List;

public class ExcelWriteDemo {

    public static void main(String[] args) {
        //1.指定excel文件所在目录和文件名称
        String filename = "D:\\0728_java_shangyitong\\0728888.xlsx";
        //2.调用方法，执行写的操作
        EasyExcel.write(filename,Student.class)
                .sheet("写操作")
                .doWrite(getData());
    }
    
    private static List<Student> getData(){
        List<Student> list = new ArrayList<Student>();
        for (int i = 0; i < 10 ; i++) {
            Student student = new Student();
            student.setStuId(i);
            student.setStuName("熊二"+i);
            list.add(student);
        }
        return list;
    }
}
